<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>利润分析管理</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="decorator" content="ani"/>
	<%@ include file="/webpage/include/bootstraptable.jsp"%>
	<%@include file="/webpage/include/treeview.jsp" %>
	<%@include file="profitList.js" %>
	<style>
		   table tbody {  display:block; height:350px; overflow-y:scroll;
		}    
		  table thead, tbody tr {  display:table;  width:100%;table-layout:fixed;  
		  }  

	</style>
	<script>

        function cx() {
            var dzs=$("#dzs").val();
            var qyd=$("#qyd").val();
            var mdd=$("#dzd").val();
            var min=$("#minx").val();
            var max=$("#maxx").val();
            $.ajax({
                url : "${ctx}/fee/profit/cx?qyd="+qyd+"&dzs="+dzs+"&mdd="+mdd+"&min="+min+"&max="+max,
                success : function(data) {
                    $("#detil").empty();
                    $.each(JSON.parse(data), function (idx, item) {
                        if(item.id==null||item.id==""){

                            $("#zsr").text(item.sr);
                            $("#zzc").text(item.zzc);
                            $("#mlr").text(item.lr);
                            $("#sj").text(item.sj);
                            $("#lrl").text(item.lrl);
                            $("#zzl").text(item.dzs);
                            $("#ids").val(item.remarks);
                        }else{
                            var addTr = $("<tr></tr>");
                            addTr.appendTo("#detil");
                            addTr.append($('<td></td>').text(item.pro));
                            addTr.append($('<td></td>').text(item.shipmentNumbers));
                            addTr.append($('<td></td>').text(item.number));
                            addTr.append($('<td></td>').text(item.qyd));
                            addTr.append($('<td></td>').text(item.dzs));
                            addTr.append($('<td></td>').text(item.dzd));
                            addTr.append($('<td></td>').text(item.remarks));
                            addTr.append($('<td></td>').text(item.sr));
                            addTr.append($('<td></td>').text(item.zzc));
                            addTr.append($('<td></td>').text(item.sl));
                            addTr.append($('<td></td>').text(item.sj));
                            addTr.append($('<td></td>').text(item.lr));

                            addTr.append($('<td></td>').text(item.lrl));
                        }
                    })
                },
                error : function(data){
                    alert("操作失败!");
                }
            });
        }
        function dc() {
            var ids=$("#ids").val();
            if(ids==""){
                jp.warning("没有可导出的数据");
                return;
			}

            window.location="${ctx}/fee/profit/daochu?ids="+ids;
        }
	</script>
</head>
<body>
	<div class="wrapper wrapper-content">
	<div class="panel panel-primary">
	<div class="panel-heading">
		<h3 class="panel-title">利润分析列表</h3>
	</div>
	<div class="panel-body">
		<sys:message content="${message}"/>

	<!-- 搜索 -->

		<div class="col-xs-6 col-sm-3 col-md-2">
					<label class="label-item single-overflow pull-left" title="装运单号：">起运地：</label>
					<input id="qyd" htmlEscape="false" maxlength="64"  class=" form-control"/>
				</div>
		<div class="col-xs-6 col-sm-3 col-md-2">
			<label class="label-item single-overflow pull-left" title="装运单号：">到站省：</label>
			<input id="dzs" htmlEscape="false" maxlength="64"  class=" form-control"/>
		</div>
			<div class="col-xs-6 col-sm-3 col-md-2">
					<label class="label-item single-overflow pull-left" title="装运单号：">到站地：</label>
					<input id="dzd" htmlEscape="false" maxlength="64"  class=" form-control"/>
				</div>
			<div class="col-xs-6 col-sm-3 col-md-2">
					<label class="label-item single-overflow pull-left" title="起始日期：">起始日期：</label>
					<div class="col-xs-12">
						<div class='input-group form_datetime' id='min'>
							<input type='text'  id="minx" class="form-control "/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>
					</div>
				</div>
			<div class="col-xs-6 col-sm-3 col-md-2">
					<label class="label-item single-overflow pull-left" title="截止日期：">截止日期：</label>
					<div class="col-xs-12">
						<div class='input-group form_datetime' id='max'>
							<input type='text'  id="maxx" class="form-control "/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>
					</div>
				</div>
				<shiro:hasPermission name="fee:profit:pro">
					<div class="col-xs-6 col-sm-3 col-md-2">
					<label class="label-item single-overflow pull-left" title="：">项目：</label>
					<select id="pro" class=" form-control">
						<option value="">请选择</option>
						<option value="武汉润滑油仓储项目">武汉润滑油仓储项目</option>
						<option value="北京润滑油运输项目">北京润滑油运输项目</option>
						<option value="天津润滑油运输项目">天津润滑油运输项目</option>
						<option value="西安润滑油仓储配送项目">西安润滑油仓储配送项目</option>
						<option value="郑州润滑油运输项目">郑州润滑油运输项目</option>
						<option value="重庆润滑油仓储配送项目">重庆润滑油仓储配送项目	</option>

						<option value="石家庄润滑油仓储配送项目">石家庄润滑油仓储配送项目</option>
					</select>
				</div>
				</shiro:hasPermission>
			<div class="col-xs-6 col-sm-3 col-md-2">
			<div style="margin-top:26px">
			  <a  id="search" onclick="cx()" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
			  <a  id="reset" onclick="dc()" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 导出</a>
			 </div>
	</div>

</div>
		<div>
			<table class="table text-nowrap">
				<input type="hidden" id="ids"/>
				<tr>
					<th>总运量</th>
					<th id="zzl"></th>
					<th>总收入</th>
					<th id="zsr"></th>
					<th>总支出</th>
					<th id="zzc"></th>
					<th>税金</th>
					<th id="sj"></th>
					<th>毛利润</th>
					<th id="mlr"></th>
					<th>利润率</th>
					<th id="lrl"></th>
				</tr>
			</table>
		</div>
		<div style="overflow: scroll;   width:100%;height: 500px;">
<table id="table"class="table text-nowrap "  align="center" >
	<tr>
		<th>项目</th>
		<th>装运单号</th>
		<th>提货单号</th>
		<th>起运地</th>
		<th>到站省</th>
		<th>到站地</th>
		<th>运量</th>
		<th>总收入</th>
		<th>总支出</th>
		<th>税率</th>
		<th>税金</th>
		<th>毛利润</th>
		<th>利润率</th>
		<th></th>
	</tr>


	<tbody id="detil" ></tbody>

</table>
		</div>




	</div>
	</div>
	</div>
</body>
</html>